#pragma once
#include "TMaterial.h"
#include "TCustomCtrl.h"
#include "TMaterialSample.h"

class TTexMapSettingDlg : public CDialog
{
	// Construction
public:
	TTexMapSettingDlg(CWnd* pParent = NULL);   // standard constructor

	enum { IDD = IDD_TEXMAP_PARA };
	CComboBox	m_wndSampSize;
	CSliderCtrl	m_wndOffVSlide;
	CSliderCtrl	m_wndOffUSlide;
	TRatioSpin	m_wndOffVSpin;
	TRatioSpin	m_wndOffUSpin;
	TImageStatic	m_wndOffSample;
	TMaterialSample	m_wndMatSample;
	CEdit	m_wndMapFile;
	TImageStatic	m_wndImagePreview;
	CEdit	m_wndSizeV;
	CEdit	m_wndSizeU;
	CEdit	m_wndOffV;
	CEdit	m_wndOffU;
	BOOL	m_bAutoNormal;
	BOOL    m_bRelativePath;
	int		m_iFixSize;
	int		m_iTileMode;
	int		m_iSampleType;

public:
	void SetMaterialData(const TMaterial &data);
	const TMaterial &GetMaterialData();
	void SetMapType(int iType) { m_iMapType=iType; }

protected:
	virtual void DoDataExchange(CDataExchange* pDX);

protected:
	virtual BOOL OnInitDialog();
	afx_msg void OnEditchangeSampSize();
	afx_msg void OnChangeEditSizeu();
	afx_msg void OnChangeEditSizev();
	afx_msg void OnChangeEditOffu();
	afx_msg void OnChangeEditOffv();
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void OnSelendokSampSize();
	afx_msg void OnFixSize();
	afx_msg void OnClampMode();
	afx_msg void OnAutoNormal();
	afx_msg void OnChangeMapFile();
	afx_msg void OnRadioSphere();
	afx_msg void OnRadioRect();
	afx_msg void OnSelectFile();
	DECLARE_MESSAGE_MAP()

	void OnMaterialDataChanged();
	TTextureOption &GetMapSetting();
	void UpdateFromEdit(CSliderCtrl &slider, CEdit &edit);
	void UpdateOffSamp();
protected:
	TMaterial m_MaterialData;
	int m_iMapType; // 0--Dif; 1--SPe; 2--Bum
	BOOL m_bLockStatus;
};

